home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / int13v20.arc / INT13.DOC < prev   
Encoding:
Text File  |  1985-12-06  |  10.1 KB  |  205 lines

  1.     
  2.  
  3.           (Version 2.0, December 5, 1985)
  4.  
  5.                                INT13 DOCUMENTATION
  6.  
  7.  
  8.      The file INT13V20.ARC contains the following:
  9.  
  10.                        INT13.ASM - Source file for INT13.COM
  11.                        INT13.COM - Resident interrupt 13h handler
  12.                        INT13.DOC - This documentation file
  13.  
  14.  
  15.          I. Function of INT13.COM
  16.  
  17.          INT13.COM is a resident "front-end" program which intercepts ROM
  18.      BIOS interrupt 13h calls to perform disk functions on specific sectors.
  19.      INT13.COM prints out the following information about each interrupt 
  20.      13h call:
  21.  
  22.         Information sent to Interrupt 13h processing-
  23.  
  24.             1. Requested disk drive (program currently reports only calls to 
  25.                        drive A:) 
  26.             2. Side number
  27.             3. Track number
  28.             4. Sector number
  29.             5. Number of sectors requested
  30.             6. Operation type (0=reset 1=read status 2=read 3=write 4=verify) 
  31.  
  32.         Information received from interrupt 13h processing-
  33.  
  34.             7. Return code (result of interrupt 13h call, 00 = no error)
  35.             8. Address immediately after point where call was made
  36.      *      9. ST0 - see XT Technical Reference Manual pps. 1-164-166
  37.      *     10. ST1    "  "      "         "       "     "      "
  38.      *     11. ST2    "  "      "         "       "     "      "    
  39.      *     12. C  (track found by controller)
  40.      *     13. H  (side found by controller)
  41.      *     14. R  (sector found by controller, not reliable)
  42.      *     15. N  (sector size, 0=128, 1=256, 2=512, 3=1024, etc.)
  43.      
  44.         * = new features of version 2.0
  45.  
  46.          II. Purpose of INT13.COM
  47.  
  48.          INT13.COM was written as a tool to help unravel copy protection
  49.      schemes, virtually all of which use interrupt 13h to look for weirdly-
  50.      formatted tracks on the original "key" diskette.  This utility allows
  51.      you to find out - without searching through a disassembly of the program
  52.      - what the copy protection scheme is looking for on the key diskette.
  53.      The return address printed shows where (or, more accurately, the point
  54.      immediately after) the call to interrupt 13h was made.  This can be
  55.      especially useful where the copy protection scheme trys - as many do -
  56.      to disguise the interrupt call so as to thwart casual attempts to defeat
  57.      the protection.
  58.  
  59.          I will not attempt to provide detailed information on the various 
  60.      codes associated with interrupt 13h processing since this information is 
  61.      available in any book on IBM Assembly Language or in the IBM Technical 
  62.      Reference manuals.  In general, however, a few things to look for in a 
  63.      protection scheme are: 
  64.  
  65.             a.  Sector numbers outside the normal range of 1 through 9.
  66.  
  67.             b.  Sectors deliberately formatted with CRC errors.  The pro-
  68.                 tection scheme either "reads" (operation code 02) or "veri-
  69.                 fies" (operation code 04) the sectors.  The program then
  70.                 expects to get a return code of 10, indicating the sectors do 
  71.                 indeed contain CRC errors.  (CRC errors can occur in the data 
  72.                 field and the id fields.  The return code field does not 
  73.                 distinguish between the two; the type of CRC error is shown 
  74.                 by the values in ST1 and ST2).  
  75.  
  76.             c.  Multiple calls for the same sector.  Some schemes format a
  77.                 track with two sectors with the same number.
  78.  
  79.             d.  Missing sector numbers on an otherwise normal track.
  80.  
  81.             e.  Sectors with "N" sizes other than the normal 2 (512 bytes).
  82.  
  83.  
  84.          III. Using INT13.COM
  85.  
  86.          Before executing the program to be examined, simply run INT13.  A 
  87.      short message will be displayed indicating that the program has been 
  88.      installed.  Your printer will display the information described above, 
  89.      one line for each interrupt 13h call.  When you are finished, execute 
  90.      INT13 one more time, and it will un-install itself, displaying a message 
  91.      to this effect.  
  92.  
  93.          With the amount of information displayed for each int 13h call, 
  94.      appoximately 130 characters are printed on each line.  The default setup 
  95.      is for INT13 to use the Epson "compressed" mode of printing to accomodate 
  96.      all the data on a single line.  If your printer does not have a 
  97.      "compressed" mode, you may force 80-column printing by entering INT13 /8.  
  98.      
  99.          If you are not using DEBUG, then simply execute your program.  A log 
  100.      of the disk activity will then be printed.  Program loading and execu-
  101.      tion will be slowed due to the time required for printing.  
  102.  
  103.          If you are using DEBUG, then proceed as you would normally.  The 
  104.      addresses reported on the disk activity log will correspond to the 
  105.      locations in the program being debugged so you may immediately see where 
  106.      the calls are being made.  
  107.  
  108.          It is advisable to run INT13 with your program more than one time
  109.      since some protection schemes select different tracks for checking on a
  110.      random basis.
  111.  
  112.          Note: Since copy protection schemes rarely, if ever, check other
  113.      than the "A" diskette drive, INT13 is set up to log only calls to that
  114.      drive.  If you wish disk activity on all drives to be logged, remove the
  115.      instructions listed in the source code and reassemble the program.
  116.  
  117.  
  118.          IV.  Interpreting the results
  119.  
  120.          This is the hardest part.  If you are going to become an accom-
  121.      plished "unprotector" you will have to have at least a passing knowledge
  122.      of assembly language.  INT13 will point you to the part(s) of the pro-
  123.      gram doing the protection verification and will show you what the pro-
  124.      gram expects to find.  It's up to you to figure out how to bypass the
  125.      protection.  This can be quite easy, sometimes only requiring a branch
  126.      around the code doing the protection verification, or it can involve
  127.      hours of single-stepping through the program for really devious
  128.      protection schemes.  Either way, INT13 should speed up things.
  129.  
  130.  
  131.          V.  Caveats
  132.  
  133.          Since INT13 functions under DOS's control, this utility will not
  134.      always function with some game programs which have their own operating
  135.      system on the disk.
  136.  
  137.          INT13 also doesn't work with Prolok- and Softguard-protected 
  138.      diskettes because these systems access the diskette adapter directly and 
  139.      do not use interrupt 13h.
  140.  
  141.  
  142.          VI.  How INT13 works
  143.  
  144.          When you run INT13, the vector in low memory which normally points
  145.      to the ROM BIOS routine for interrupt 13h is changed to point to the
  146.      front-end processing contained in INT13.  When your program issues an
  147.      interrupt 13h call, control goes first to INT13 and the required
  148.      information is stored for later printout.  Control is then passed to the
  149.      normal interrupt 13h routine.  When the I/O processing is finished,
  150.      INT13 regains control and prints the log data, including the return code
  151.      passed back.  Finally, control returns to the calling program.  If you
  152.      are interested in further details, examine the source code.
  153.  
  154.  
  155.          VII.  How some protection schemes attempt to disguise interrupt 13h
  156.                calls
  157.  
  158.          If you are attempting to unprotect a program, the usual course of
  159.      action is to search for occurences of "CD13", which is machine language
  160.      for interrupt 13h.  One way or another, the protection scheme will have
  161.      to use this interrupt to check for the special sectors on the disk.  If
  162.      you examine a cross section of programs, however, you will find programs
  163.      which do not have "CD13" in their machine code, but which clearly are
  164.      checking the key diskette for weird sectors.  How is this being done?
  165.  
  166.          There are several techniques which can be used to camouflage the
  167.      protection scheme from prying eyes.  I'll describe below two such
  168.      techniques I have come across:
  169.  
  170.          a.  The following section of code is equivalent to issuing a INT 13
  171.              command to read one sector from: drive A, side 0, track 28h,
  172.              sector ffh, and then checking for a status code of 10h:
  173.  
  174.              XXXX:1000 MOV AH,02                  ;read operation
  175.              XXXX:1002 MOV AL,01                  ;1 sector to read
  176.              XXXX:1004 MOV CH,28                  ;track 28h (40d)
  177.              XXXX:1006 MOV CL,FF                  ;sector ffh (255d)
  178.              XXXX:1008 MOV DX,0000                ;side 0, drive A
  179.              XXXX:100B XOR BX,BX                  ;move 0
  180.              XXXX:100D MOV DS,BX                  ;       to DS register
  181.              XXXX:100F PUSHF                      ;push the flags onto stack
  182.              XXXX:1010 PUSH CS                    ;push the CS register
  183.              XXXX:1011 CALL 1100                  ;push addr. of next instr.
  184.                                                   ; onto stack and branch
  185.              XXXX:1014 CMP AH,10                  ;check for CRC error
  186.              XXXX:1017 rest of verification code
  187.                   .
  188.                   .
  189.                   .
  190.              XXXX:1100 PUSHF                      ;push the flags onto stack
  191.              XXXX:1101 MOV BX,004C                ;addr. of int 13h vector
  192.              XXXX:1104 PUSH [BX+02]               ;push CS of int13h routine
  193.              XXXX:1107 PUSH [BX]                  ;push IP of int13h routine
  194.              XXXX:1109 IRET                       ;pop IP,CS and flags
  195.  
  196.              Notice that there is no "INT 13" command in the source code, so
  197.              if you had simply used DEBUG to search for "CD13" in the machine
  198.              code, you would never have found the protection routine.
  199.  
  200.  
  201.          b.  Another technique is to put in a substitute interrupt instruc-
  202.              tion (such as INT 10, which looks harmless enough), and have the
  203.              program change the "10" to "13".  A search for "CD13" would turn
  204.              up nothing.
  205.